﻿using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {  /*一维数组数据应用及三种类型 int系统默认值为0而string默认为null*/
            string[] big = new string[5];

            string[] newBig = { "憨憨", "涵涵", "韩寒" };

            double[] newBigName = new double[3] { 10.0, 50.6, 30.5 };

            Console.WriteLine(big);

            Console.WriteLine(newBig);

            Console.WriteLine(newBigName);

            /*二维数组 被包裹在内部如 一维{1,2,3} 二维则把1,2,3看成一个整体内部继续添加多维依次类推*/
            double[,] grade = { { 100, 99.5 }, { 80, 95 }, { 88, 84.5 } };
            for (int i = 0; i < grade.GetLength(0); i++)
            {
                Console.WriteLine("第" + (i + 1) + "个人的成绩:");
                for (int j = 0; j < grade.GetLength(1); j++)
                {
                    Console.Write(grade[i, j] + "");
                }
                Console.WriteLine();
            }
            /*foreach foreach(数据类型  变量名  in  数组名){//语句块； }*/
            double[] points = new double[5] { 100, 55, 66.7, 88, 99 };
            double sum = 0;
            double avg = 0;
            foreach (double point in points)
            {
                sum = sum + point;
            }
            avg = sum / points.Length;
            Console.WriteLine("总和为:" + sum);
            Console.WriteLine("平均数为:" + avg);
            /*Split 分割字符输出  只能分割一个字符*/
            string name = "我是人，我是有钱人，我是好人，我不是坏人，我是大大的好人";

            char[] newName = new char[] { '，' };

            string[] newNameBig = name.Split(newName);

            for (int i = 0; i < newNameBig.Length; i++)
            {
                Console.WriteLine(newNameBig[i]);
            }

        }
    }
}
